﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using DAL;


namespace StudentManagerPro.Student
{
    public partial class StudentDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //根据学号查询信息
                string studentId = Request.QueryString["StudentId"].ToString();
                if (string.IsNullOrEmpty(studentId))
                {
                    Response.Redirect("~/ErrorPage.html");
                    return;
                }
                else
                {
                    StudentExt student = new StudentService().QueryStudent(studentId);
                    //展示学员信息
                    if (student == null)
                    {
                        Response.Redirect("~/ErrorPage.html");
                        return;
                    }
                    else
                    {
                        this.ltaStudentId.Text = studentId;
                        this.ltaStudentName.Text = student.StudentName;
                        this.ltaStudentIdNo.Text = student.StudentIdNo;
                        this.ltaBirthday.Text = student.Birthday.ToString("yyyy-MM-dd");
                        this.ltaAddress.Text = student.StudentAddress;
                        this.ltaPhoneNumber.Text = student.PhoneNumber;
                        this.ltaClass.Text = student.ClassName;
                        this.ltaGender.Text = student.Gender;
                        this.stuImg.ImageUrl = "~/Images/NewImages/" + student.StudentId + "jpg";
                    }

                }
              


            }
        }
    }
}